#include "mypushbutton.h"
#include <QDebug>

MyPushButton::MyPushButton(QString img)
{
    this->imgPath = img;

    QPixmap pixmap;
    bool ret = pixmap.load(imgPath);
    if(!ret)
    {
        qDebug()<<"图片加载失败";
        return;
    }

    //设置图片固定大小
    this->setFixedSize(pixmap.width(),pixmap.height());

    //设置不规则图片样式    QPushButton类{边框0像素}
    this->setStyleSheet("QPushButton{border:0px;}");

    //设置图标
    this->setIcon(pixmap);

    //设置图标大小
    this->setIconSize(QSize(pixmap.width(),pixmap.height()));


}
